<template>
  <footer class="footer">
    <span class="todo-count"
      >剩余<strong>{{ count }}</strong></span
    >
    <ul class="filters" @click="fn">
      <li>
        <a
          :class="{ selected: isSel === 'all' }"
          href="javascript:;"
          @click="isSel = 'all'"
          >全部</a
        >
      </li>
      <li>
        <a
          :class="{ selected: isSel === 'no' }"
          @click="isSel = 'no'"
          href="javascript:;"
          >未完成</a
        >
      </li>
      <li>
        <a
          :class="{ selected: isSel === 'yes' }"
          @click="isSel = 'yes'"
          href="javascript:;"
          >已完成</a
        >
      </li>
    </ul>
    <button class="clear-completed" @click="$emit('clearFn')">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: ['arr'],
  data() {
    return {
      isSel: 'all',
    }
  },
  computed: {
    count: {
      get() {
        return this.arr.length
      }
    }
  },
  methods: {
    fn(){
      this.$emit('changType',this.isSel)
    },

  },

}
</script>